<template>
  <el-dialog 
  v-model="dialogFormVisible" 
  title="修改员工信息" 
  top="30px"
  :close-on-click-modal="false"
  width="450px"
  label-position="left">
    <div class="info-body">
        <el-form :model="form">
            <el-form-item label="名称" prop="name" style="width: 300px;">
                <el-input v-model="form.name" />
            </el-form-item> 
            <el-form-item label="账号" prop="account" style="width: 300px;">
                <el-input v-model="form.account" />
            </el-form-item>
            <el-form-item label="密码" prop="password" style="width: 300px;">
                <el-input v-model="form.password" type="password"/>
            </el-form-item>
            <el-form-item label="职位" prop="position">
                <el-select v-model="form.position" >
                <el-option value="物资管理" />
                <el-option value="通知管理" />
                <el-option value="报备人员管理" />
                <el-option value="社区人员管理" />
                <el-option value="员工管理员" />
                </el-select>
            </el-form-item>
            <el-form-item label="权限" prop="authority" >
                <el-select v-model="form.authority" >
                <el-option value="超级管理员" />
                <el-option value="普通管理员" />
                </el-select>
            </el-form-item>
        </el-form>
    </div>

    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="submitModifyInfo">修改</el-button>
      </span>
    </template>
  </el-dialog>
</template>
import { ElMessage } from "element-plus";
<script>
    export default {
        data() {
            return {
                dialogFormVisible: false,
                id:'',
                form: {
                name: '',
                account: '',
                password: '',
                position: '',
                authority: '',
                },  
            };
        },
        methods: {
            //显示对话框
            dialogShow(data){
                this.dialogFormVisible=true;
                this.id=data.id;
                this.form.name=data.name;
                this.form.account=data.account;
				this.form.password=data.password;
				this.form.position=data.position;
				this.form.authority=data.authority;
            },
            //提交修改信息
            submitModifyInfo(){
				var that=this;
				let params = {
          id:this.id,
          name:this.form.name,
          account:this.form.account,
          password:this.form.password,
          position:this.form.position,
          authority:this.form.authority
				};
				this.axios
				.post("/staff/update", params)
				.then(function () {
          that.$emit("updateData");
          that.dialogFormVisible=false;
				})
				.catch(function (error) {
          console.log(error);
				});
				
         
        },
        mounted(){

        }
    }
}
</script>
<style scoped>
.info-body{
    margin-left: 40px;
}


</style>
